package com.uni.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.uni.common.util.SystemConfig;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * 店铺
 * @author yuyanzheng
 *
 */
@NoArgsConstructor
@Data
public class ShopbgDTO {
    private Long id;
    private Long userId;
    private String nickname;
    private String name;
    private String coverUrl;
    private Integer startingPrice;
    private String longitude;
    private String latitude;
    private Long schoolId;
    private String schoolName;
    private Integer status;
    private Integer deleted;
    @JsonFormat(timezone = "GMT+8", pattern = "YYYY-MM-dd HH:mm:ss")
    private Date updateTime;
    @JsonFormat(timezone = "GMT+8", pattern = "YYYY-MM-dd HH:mm:ss")
    private Date createTime;
    private List<ShopCommodityDTO> shopCommoditys;

    public String getCoverUrlAll() {
        if(coverUrl != null && !"".equals(coverUrl) && !coverUrl.startsWith("http")) {
            return SystemConfig.basePath + coverUrl;
        }
        return coverUrl;
    }


}
